<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
        <title>首页</title>
        <script src="lib/vue.js"></script>
        <script src="lib/axios.min.js"></script>
        <link rel="stylesheet" href="lib/element_ui.css">
        <style>
            html,body{
                height: 100%;
                width:100%;
                margin:0 0 0 0;
                overflow:hidden hidden;
                background-image:url("imgs/index_background.jpg");
                background-size: cover;
                background-repeat: no-repeat;
            }
            #login{
                width: 20%;
                height: 25%;
                margin-top: 25%;
                margin-left: 5%;
            }
            #box{
                margin-top: 30%;
            }
        </style>
    </head>
    <body>
        <div id="box">
            <el-form ref="form" :model="form" label-width="80px" id="login" id="login">
                <el-form-item label="账号">
                <el-input v-model="form.username" clearable></el-input>
                </el-form-item>
                <el-form-item label="密码">
                    <el-input v-model="form.password" show-password></el-input>
                </el-form-item>
                <el-form-item>
                <el-button type="primary" @click="onLogin()">登录</el-button>
                <el-button @click="onRest()">重置</el-button>
                </el-form-item>
            </el-form>
        </div>
        <script src="lib/element_ui.js"></script>
        <script>
            new Vue({
                el:"#box",
                data:{
                    form:{
                        username:"",
                        password:""
                    }
                },
                methods: {
                    onLogin(){
                        axios.post("/login", this.form).then(item=>{window.location.href = item.data;});
                    },
                    onRest(){
                        this.form.username = "";
                        this.form.password = "";
                    }
                }
            });
        </script>
    </body>
</html>